Page 1 of 3 123 LastLast
Results 1 to 10 of 21

Thread: Understanding Triggers and the Easy Way to Create Them

  1. #1

    Default Understanding Triggers and the Easy Way to Create Them

    Hi All,

    I may have understood triggers at one point in the past, but I'm confused again as I try to create several triggers for the push mod.

    So, triggers have an origin (I typically place the origin in the middle between 2 spots?). Great, I can get that information. Setting the size is a different story. What's the best way to figure out which number goes where?

    For example:

    Code:
    local.trig setsize ( -20 -20 -10 ) ( 20 20 10 )
    I'm assuming that you read trigger sizes as this ( x y z ) . Please correct me if I'm wrong, but my understanding is that:

    X is North and South (gets more positive as you go North). Y is East and West (gets more positive as you go West). Z is Depth (gets more positive as you go higher )?

    So, what if I have an origin of ( 1056 5402 -206.38 ), the midpoint of my trigger. I went to where a wall on my left (x changed to 1286 and y changed to 5514) and went to where a wall is on my players right (x changed to 915 and y changed to 5241). My player was looking directly NE.

    Does this mean my size should be:

    Code:
    local.trig setsize ( (915 - 1056) (5241 - 5402) -10 ) ( (1286-1056) (5514 - 5402) 10 )
    I don't get it... is there a mod out there that will create triggers? If not, could anyone write one if you understand triggers? If it could somehow work like the EZ Spawner everyone would use it, as it is quite confusing how to create triggers and set their size. Any help is appreciated. I know this is a confusing topic, so I'd like to learn it. Is there an easy formula to calculate what the size should be? Should I set an origin (take a reading), strafe left (take a reading), strafe right (take a reading), move forward (take a reading), and then move backwards (take a reading)? With 5 positions, could I just subtract the origin from the bigger number for the number in the right set of brackets where the number should be positive and just subtract the origin's number from the smaller number for the left set of brackets where the number should be negative?

    I'm really confused. Please help!

  2. #2

    Default

    Yes that's it exactly.

    But, something like this may be easier for you. You just put the two coordinates in from each corner of the 'box' you want to make.

    So lets say we name this global/trigger.scr

    Taking the coordinates you gave above, you would do it like this: One corner is ( 1286 5514 -206.38 ) The opposite corner is ( 915 5241 -206.38 ) Now put them together...

    waitexec global/trigger.scr 1286 5514 -206.38 915 5241 -190 //Noticed that I manually changed the height (-190) to however high you think it needs to be.

    PHP Code:
    main local.x1 local.y1 local.z1 local.x2 local.y2 local.z2:

        
    local.x1 floatlocal.x1 ) ; local.x2 floatlocal.x2 )
        
    local.y1 floatlocal.y1 ) ; local.y2 floatlocal.y2 )
        
    local.z1 floatlocal.z1 ) ; local.z2 floatlocal.z2 )

        
    // Make sure coords are in right order // Taken from MAM
        
    if ( local.x1 local.x2 )
        {
            
    local.local.x1 local.x1 local.x2 local.x2 local.x
        
    }
        if ( 
    local.y1 local.y2 )
        {
            
    local.local.y1 local.y1 local.y2 local.y2 local.y
        
    }
        if ( 
    local.z1 local.z2 )
        {
            
    local.local.z1 local.z1 local.z2 local.z2 local.z
        
    }

        
    local.trigObj spawn trigger_multiple
        local
    .trigObj.origin = ( local.x1 local.y1 local.z1 )
        
    local.trigObj setsize 0 0 0 ) ( ( local.x2 local.y2 local.z2 ) - ( local.x1 local.y1 local.z1 ) )
        
    local.trigObj setthread triggered
        
    end

    triggered
    :

        
    local.player parm.other
        
        
    //do what you want with local.player now...

    end 

  3. #3

    Default

    Oki, I'm too tired and in a rush right now to read your post. (LAZY???)!

    The BEST write up I ever saw was by Cobra SFX which is on TMT (or maybe mru?) I'm sure its TMT.

    Explaining how to use triggers.., how they work!

    You can SEE triggers
    You can either use Bdbodgers mod to view triggers <- this was designed to see them when spawning them etc for ease ..and what you might need!
    or
    You can use a cvar....sv_showbboxes 3 (I think)
    NOTE you must start with cheats PROPERLY and set it 0 before restarting.


    Also, why use triggers? I don't understand why you need a trigger for a push mod?

    Also, Why not wait until the surface commands are released?
    This would allow a generic script to detect if someone is stood by and blocking a door.
    -Note: Sor mentioned it's not always someone stood on at a door.

    This leaves us with more options...and a question..how do we solve this?
    it might be a good extension mod for the gallery of mods which will be available to download to compliment the patch ...(when I get round to actually doing some scripting WHICH I AM LOOKING FORWARD TO!, just so fucking busy trying to live)
    anyway to the point:

    How do we actually solve this?

    Do we
    A:
    Have people able to just push each other if they walk in to them for over a second and the person does not move...they start to be pushed.

    B.
    bash push?

    C.
    only push in detected doorways


    other?

  4. #4

    Default

    Elgan, I should rephrase. My mod is a work-in-progress to expand the gain ground mod (also called Push) to other SP maps that Viper released since the LMAO clan never released their proprietary mod.

  5. #5

    Default

    Interesting.

    how does it work?

  6. #6

    Default

    Quote Originally Posted by Elgan View Post
    Interesting.

    how does it work?
    Basically, as players trigger a series of triggers, their spawn location moves up to that trigger they just activated. If a player makes it to the opposite spawn, they score a point and have to start over again from the next closest spawn where the next furthest player on their team is... I guess that wasn't as basic as I could be, so let me try again:

    Teams attempt to "push" the other team back and gain ground. As they gain ground, after a player dies, they spawn closer to the action to simulate reinforcements. It's about crossing enemy lines and keeping the other team pinned back in their own territory.

    Viper made a mod a long time ago that was awesome, but it was only 1 map. I have taken his code and am attempting to support more SP maps. This mod was cool back in the day... it had the most players. Hopefully I can get it done. I think I just finished the basic code to my first additional map. Am going to try it with the trigger tools you listed so that I can see what's going on with my triggers.

  7. #7

    Default

    Quote Originally Posted by armageddon View Post
    Yes that's it exactly.

    But, something like this may be easier for you. You just put the two coordinates in from each corner of the 'box' you want to make.

    So lets say we name this global/trigger.scr

    Taking the coordinates you gave above, you would do it like this: One corner is ( 1286 5514 -206.38 ) The opposite corner is ( 915 5241 -206.38 ) Now put them together...

    waitexec global/trigger.scr 1286 5514 -206.38 915 5241 -190 //Noticed that I manually changed the height (-190) to however high you think it needs to be.
    Thank you so much! So, does it matter if I change the height? The worst it could do is?

    For example, the original heights of the corner triggers:

    Code:
    local.fix1 = spawn script_model model models/static/indycrate.tik origin ( 1927.751 4914.122 -201.855 ) angle ( 315.549 )
    local.fix1 = spawn script_model model models/static/indycrate.tik origin ( 1519.125 3807.125 -228.071 ) angle ( 247.396 )
    Would this impact anything other than ensure players will hit this trigger?

    Code:
    local.fix1 = spawn script_model model models/static/indycrate.tik origin ( 1927.751 4914.122 -191.855 ) angle ( 315.549 )
    local.fix1 = spawn script_model model models/static/indycrate.tik origin ( 1519.125 3807.125 -238.071 ) angle ( 247.396 )
    The above is just the raw output I got from the EZSpawner. I am calling the script you provided though in my actual code! Hope it works!

  8. #8

    Default

    sounds cool

  9. #9

    Default

    Elgan, do you know where I can download Bdbodgers mod? It sounds like this is what I need. I could do it manually, but I prefer mods.

  10. #10
    Purple Developer Purple Elephant1au's Avatar
    Join Date
    Feb 2012
    Location
    Australia
    Posts
    1,259

    Purple's Playground
    OBJ :
    103.29.85.127:12203
    xfire: purpleelephant1au
    email: purpleelephant1au@gmail.com
    skydrive: PurpleElephantSkydrive




Page 1 of 3 123 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •